package com.qianli.cashmama.trade.common.utils;

import com.alibaba.nacos.api.config.annotation.NacosValue;
import com.alibaba.nacos.client.config.NacosConfigService;
import com.fqgj.exception.common.ApplicationException;
import com.google.common.collect.Lists;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by linchengyu on 17/4/14.
 */
@Component
public class TradeConfigUtil {

    @NacosValue(value = "${audit.push.switch:0}", autoRefreshed = true)
    private String audit_push_switch;

    public String audit_push_switch() {
        return audit_push_switch;
    }


    @NacosValue(value = "${oss.bucketName}", autoRefreshed = true)
    private String getBucketName;

    public String getBucketName() {
        return getBucketName;
    }

    @NacosValue(value = "${oss.baseUrl}", autoRefreshed = true)
    private String getBucketBasUrl;

    public String getGetBucketBasUrl() {
        return getBucketBasUrl;
    }

    @NacosValue(value = "${getSignTimeoutRemindSms:Thank you for choosing Cashmama for your financial needs, we have approved your loan and it is waiting to be disbursed. The last step remaining is for you to e-Sign the loan agreement and soon your loan will be disbursed. Do note, of you have not e-Signed the loan agreement till the 7 days of approval, your loan application will be void.}", autoRefreshed = true)
    private String getSignTimeoutRemindSms;

    public String getSignTimeoutRemindSms() {
        return getSignTimeoutRemindSms;
    }

    @NacosValue(value = "${messageSwitch:0}", autoRefreshed = true)
    private String messageSwitch;

    public String messageSwitch() {
        return messageSwitch;
    }

    @NacosValue(value = "${email.push.bill.reminder.content:Your loan of __amount__INR is due today, the current amount to be repaid is __repaid__, Please repay in time.}", autoRefreshed = true)
    private String email_push_bill_reminder_content;

    public String email_push_bill_reminder_content() {
        return email_push_bill_reminder_content;
    }

    @NacosValue(value = "${email.push.bill.reminder.3days.content:This is warm reminder that 2days later is your bill day . Please make repayment in time to avoid late payment fees and affect your credit.}", autoRefreshed = true)
    private String email_push_bill_reminder_3days_content;

    public String email_push_bill_reminder_3days_content() {
        return email_push_bill_reminder_3days_content;
    }

    @NacosValue(value = "${mail.send.loan.again.notification:As a previleged user, we ask you to avail the loan facility again for your financial needs. Apply now for your next loan by clicking here <a>http://bit.ly/2Ajfd8t</a>.}", autoRefreshed = true)
    private String mail_send_loan_again_notification;

    public String mail_send_loan_again_notification() {
        return mail_send_loan_again_notification;
    }

    @NacosValue(value = "${msg.push.bill.reminder.today:Bill Reminder|Your loan of ##AMOUNT##INR is due today, the current amount to be repaid is ##REPAID##INR, please click to make repayment.|APP/main}", autoRefreshed = true)
    private String msgpushbillremindertoday;

    public String msgpushbillremindertoday() {
        return msgpushbillremindertoday;
    }

    @NacosValue(value = "${msg.push.successful.repayment:Successful Repayment|You have successfully paid ##AMOUNT##INR, the current credit record is good, please click continue to borrow.|APP/main}", autoRefreshed = true)
    private String msg_push_successful_repayment;

    public String msg_push_successful_repayment() {
        return msg_push_successful_repayment;
    }

    @NacosValue(value = "${msg.push.bill.reminder.3days:This is warm reminder that 2days later is your bill day. Please make repayment in time to avoid late payment fees and affect your credit.}", autoRefreshed = true)
    private String msg_push_bill_reminder_3days;

    public String msg_push_bill_reminder_3days() {
        return msg_push_bill_reminder_3days;
    }


    /**
     * 逾期超过多少天还款 进入冷冻期
     */
    @NacosValue(value = "${overdue.frozen.threshold:16}", autoRefreshed = true)
    private String getOverdueFrozenThreshold;

    public Integer getOverdueFrozenThreshold() {
        return Integer.valueOf(getOverdueFrozenThreshold);
    }

    /**
     * 风控地址
     */
    @NacosValue(value = "${risk.api.host:\"\"}", autoRefreshed = true)
    private String getRiskHost;

    public String getRiskHost() {
        return getRiskHost;
    }


    @NacosValue(value = "${contract.pdf.url:http://cashmama-pro.oss-ap-south-1.aliyuncs.com/app/sign_self_contract.pdf}", autoRefreshed = true)
    private String getContractPdfUrl;

    public String getContractPdfUrl() {
        return getContractPdfUrl;
    }


    @NacosValue(value = "${amazon.s3.bucketName:\"\"}", autoRefreshed = true)
    private String getAmazonBucketName;

    public String getAmazonBucketName() {
        return getAmazonBucketName;
    }

    @NacosValue(value = "${amazon.s3.base.url:\"\"}", autoRefreshed = true)
    private String getAmazonS3BaseUrl;

    public String getAmazonS3BaseUrl() {
        return getAmazonS3BaseUrl;
    }

    /**
     * 需要esign的渠道
     *
     * @return
     */

    @NacosValue(value = "${needesign.process.channel:\"\"}", autoRefreshed = true)
    private String getNeedEsignProcess;

    public String getNeedEsignProcess() {
        return getNeedEsignProcess;
    }

    /**
     * 审核通过
     */

    @NacosValue(value = "${msg.push.loan.approval:Loan Approval|Congratulations, your loan application has been approved,will get money soon!|APP/main}", autoRefreshed = true)
    private String getMsgPushLoanApproval;

    public String getMsgPushLoanApproval() {
        return getMsgPushLoanApproval;
    }

    /**
     * 审核通过邮件内容
     */

    @NacosValue(value = "${mail.push.loan.approval.content:\"\"}", autoRefreshed = true)
    private String getMailPushLoanApprovalContent;

    public String getMailPushLoanApprovalContent(String appName) {
        return String.format(getMailPushLoanApprovalContent, appName.toLowerCase());
    }

    /**
     * 审核拒绝
     */
    @NacosValue(value = "${mail.push.loan.audit.rejection.content:Your application for loan has been rejected. You can apply again on __applyDate__. }", autoRefreshed = true)
    private String getMailPushLoanAuditRejectionContent;

    public String getMailPushLoanAuditRejectionContent() {
        return getMailPushLoanAuditRejectionContent;
    }

    /**
     * 审核通过待提现邮件内容
     */

    @NacosValue(value = "${mail.push.loan.withdraw.content:\"\"}", autoRefreshed = true)
    private String getMailPushLoanNeedWithdrawContent;

    public String getMailPushLoanNeedWithdrawContent(String appName) {
        return String.format("%s.mail.push.loan.withdraw.content}", appName.toLowerCase());
    }

    /**
     * 审核拒绝
     */

    @NacosValue(value = "${trade.audit.msg.switch:false}", autoRefreshed = true)
    private Boolean getTradeAuditMsgSwitch;

    public Boolean getTradeAuditMsgSwitch() {
        return getTradeAuditMsgSwitch;
    }


    @NacosValue(value = "${open.sms.switch:false}", autoRefreshed = true)
    private Boolean isSmsReportSwitchOpen;

    public Boolean getIsSmsReportSwitchOpen() {
        return isSmsReportSwitchOpen;
    }


    /**
     * 获取信审api地址
     *
     * @return
     */

    @NacosValue(value = "${admin.rest.url:\"\"}", autoRefreshed = true)
    private String getAuditApiUrl;

    public String getAuditApiUrl() {
        return getAuditApiUrl;
    }

    @NacosValue(value = "${disabled.product.code:\"\"}", autoRefreshed = true)
    private String disabled_product_code;

    public String disabled_product_code() {
        return disabled_product_code;
    }


    @NacosValue(value = "${need.send.email.appcode:5,38}", autoRefreshed = true)
    private String getNeedSendEmailAppCode;

    public List<String> getNeedSendEmailAppCode() {
        return Lists.newArrayList(getNeedSendEmailAppCode.split(","));
    }


    /**
     * 放款成功邮件
     */
    @NacosValue(value = "${msg.mail.payment:Based on your loan application for Line of Credit facility, __NBFC NAME__, our lending partner, has\\n\" +\n" +
            "                \"                                        provided you with a credit line facility of Rs.__Amount__ on __Date__ based on the Drawdown Request from you.\\n\" +\n" +
            "                \"                                        <br /><br />\\n\" +\n" +
            "                \"                                        Please find a copy of the Application Form, Standard Terms and Most Important Terms and Conditions (MITC) for your\\n\" +\n" +
            "                \"                                        records.}", autoRefreshed = true)
    private String getPaymentEmailContent;

    public String getPaymentEmailContent() {
        return getPaymentEmailContent;
    }

    @NacosValue(value = "${pay.money.limit:\"\"}", autoRefreshed = true)
    private String getPayMoneyLimit;

    public String getPayMoneyLimit() {
        return getPayMoneyLimit;
    }

    /**
     * 支付回调地址
     *
     * @return
     */
    @NacosValue(value = "${payment.callback.url:\"\"}", autoRefreshed = true)
    private String getPaymentCallbackUrl;

    public String getPaymentCallbackUrl() {
        return getPaymentCallbackUrl;
    }

    /**
     * 审核通过待提现 短信开关
     */

    @NacosValue(value = "${trade.audit.withdraw.msg.switch:false}", autoRefreshed = true)
    private Boolean getTradeAuditWithdrawMsgSwitch;

    public Boolean getTradeAuditWithdrawMsgSwitch() {
        return getTradeAuditWithdrawMsgSwitch;
    }

    /**
     * 打款失败提醒 短信开关
     */

    @NacosValue(value = "${trade.payment.failure.msg.switch:false}", autoRefreshed = true)
    private Boolean getTradePaymentFailureMsgSwitch;

    public Boolean getTradePaymentFailureMsgSwitch() {
        return getTradePaymentFailureMsgSwitch;
    }

    //推送任务开关
    @NacosValue(value = "${openapi.push.job:false}", autoRefreshed = true)
    private Boolean openApiPushJob;

    public Boolean openApiPushJob() {
        return openApiPushJob;
    }

    @NacosValue(value = "${trade.query.3d.sync:false}", autoRefreshed = true)
    private Boolean tradeQuery3dSync;

    public Boolean tradeQuery3dSync() {
        return tradeQuery3dSync;
    }


    @NacosValue(value = "${new.allow.push.to.risk:false}", autoRefreshed = true)
    private Boolean allowPushToRisk;

    public Boolean getAllowPushToRisk() {
        return allowPushToRisk;
    }

    @NacosValue(value = "${new.allow.push.to.risk.category:false}", autoRefreshed = true)
    private String allowPushToRiskCategory;

    public String getAllowPushToRiskCategory() {
        return allowPushToRiskCategory;
    }

    @NacosValue(value = "${reject.switch.open:false}", autoRefreshed = true)
    private Boolean rejectJobSwitch;

    public Boolean getRejectJobSwitch() {
        return rejectJobSwitch;
    }


    @NacosValue(value = "${auto.reject.categories:ddd}", autoRefreshed = true)
    private String autoRejectCategories;

    public String getAutoRejectCategories() {
        return autoRejectCategories;
    }



    @NacosValue(value = "${push.select.max.size:100}", autoRefreshed = true)
    private Integer pushSelectMaxSize;

    public Integer pushSelectMaxSize() {

        return pushSelectMaxSize;
    }


    @NacosValue(value = "${push.max.retry.times:10}", autoRefreshed = true)
    private Integer pushMaxRetryTimes;

    public Integer pushMaxRetryTimes() {

        return pushMaxRetryTimes;
    }


    @NacosValue(value = "${push.job.ecs.ip:\"\"}", autoRefreshed = true)
    private String pushJobRunIp;

    public String pushJobRunIp() {
        return pushJobRunIp;
    }


    @NacosValue(value = "${allow.push.orders:\"\"}", autoRefreshed = true)
    private String allowPushOrders;

    public String getAllowPushOrders() {
        return allowPushOrders;
    }

    /**
     * 牛信短信配置
     */
    @NacosValue(value = "${nx.sms.url:no}", autoRefreshed = true)
    private String nxSmsUrl;

    public String getNxSmsUrl() {
        return nxSmsUrl;
    }

    @NacosValue(value = "${nx.sms.otp.appkey:no}", autoRefreshed = true)
    private String nxSmsOtpAppKey;

    public String getNxSmsOtpAppKey() {
        return nxSmsOtpAppKey;
    }


    @NacosValue(value = "${nx.sms.otp.secretkey:no}", autoRefreshed = true)
    private String nxSmsOtpSecretKey;

    public String getNxSmsOtpSecretKey() {
        return nxSmsOtpSecretKey;
    }

    @NacosValue(value = "${nx.sms.otp.sender:no}", autoRefreshed = true)
    private String nxSmsOtpSender;

    public String getNxSmsOtpSender() {
        return nxSmsOtpSender;
    }



    @NacosValue(value = "${allow.push.productCategoryCode:\"\"}", autoRefreshed = true)
    private String allowPushCategoryCode;

    public String getAllowPushCategoryCode() {
        return allowPushCategoryCode;
    }


    @NacosValue(value = "${allow.push.steps:0}", autoRefreshed = true)
    private String allowPushSteps;

    public String getAllowPushSteps() {
        return allowPushSteps;
    }


    @NacosValue(value = "${mh.sms.report.request.url:http://149.129.145.245:9101/api/v1/analyze-sms}", autoRefreshed = true)
    private String mhSmsReportRequestUrl;

    public String getMhSmsReportRequestUrl() {
        return mhSmsReportRequestUrl;
    }


    @NacosValue(value = "${dd.agent.url:http://fat-message.cashmama.in/dingtalk/dingDing/forward}", autoRefreshed = true)
    private String ddAgentUrl;

    public String ddAgentUrl() {
        return ddAgentUrl;
    }
}
